TestView = {}
local self = TestView

self.view = UIBase()
self.view.name = "TestView"
self.view:AddPath("ui/panels/test.gdmec")

self.view.onInit = function()
    self:OnInit()
end

self.view.onUnit = function()
    self:OnUnit()
end

function self:Close()
    self.view:Close()
end

function self:Open()
    self.view:Open()
end

function self:OnInit()

    
    self.uis = {}
    self.uis.BtnClose = UIUtil.FindButton(self.view.go,"BtnClose") --self.view.go.transform:Find("BtnClose"):GetComponent(typeof(UnityEngine.UI.Button))
    self.uis.title = UIUtil.FindText(self.view.go,"Title") -- self.view.go.transform:Find("Title"):GetComponent(typeof(UnityEngine.UI.Text))
    self.uis.BtnClose.onClick:AddListener(
        function()
            self:Close()
        end
    )

    self.uis.role = self.view.go.transform:Find("Role"):GetComponent(typeof(UnityEngine.RectTransform))
    self.uis.yr_srollview = self.view.go.transform:Find("YRScrollView")
    self.uis.ui_yr = self.uis.yr_srollview:GetComponent(typeof(CS.Gdmec.UI.UIScrollRect))

    self.var_from_x = self.uis.ui_yr.content.localPosition.x
    self.var_from_y = self.uis.ui_yr.content.localPosition.y
    
    self.var_x = 0
    self.var_y = 0

    self.uis.ui_yr.onDrop = function() 
         self.var_x = self.var_x + self.var_from_x - self.uis.ui_yr.content.localPosition.x
         self.var_y = self.var_y + self.var_from_y - self.uis.ui_yr.content.localPosition.y
         self.uis.role.localPosition = Vector3( -self.var_x, - self.var_y ,0) * 0.1
    end
end


function self:OnUnit()
end
